﻿<?php
session_start();
echo '<title>文件管理平台</title><body bgcolor="#009900">';
if(isset($_SESSION["user"])==false){
	header("location:../login.php");
	exit;
}
$user=$_SESSION['user'];
if(isset($_SESSION["dir"])==false){
	header("location:index.php");
	exit;
}
$dir=$_SESSION["dir"];

if(isset($_POST["name"])==false||$_POST["name"]==null||$_POST["name"]==""){
	echo '<h1>乖点~文件夹名字是肯定要输的~</h1><br/>';
	echo '<a href="index.php?dir=' . $dir . '">返回</a>';
}
$name=$_POST["name"];
$name=str_ireplace(".","isnot",$name);
$name=str_ireplace(";","isnot",$name);
mkdir("$user/$dir/$name");

$file=fopen("../log.txt","a");
include '../lib/time.php';
fwrite($file,"\r\n" . $time . ":'$user' in '$dir' create folder '$name'.");

header("location:index.php?dir=$dir");
exit;
?>